﻿<UserControl x:Class="StockAnalyst2.MainStatusBar"
			 x:ClassModifier="internal"
			 
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 mc:Ignorable="d" 
			 
             xmlns:Wpf="clr-namespace:Utils.Wpf;assembly=Utils" 
			 xmlns:SA2="clr-namespace:StockAnalyst2"
			 xmlns:Converters="clr-namespace:Utils.Wpf.Converters;assembly=Utils"
			 
			 d:DataContext="{d:DesignInstance Type=SA2:MainStatusBarVM}" >

	<UserControl.Resources>
		<ResourceDictionary>
			<Converters:MultiplierConverter x:Key="MultiplierConverter" />
			<Converters:EnumToIntConverter x:Key="EnumConverter" />
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="StockAnalystTheme.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>

	<UserControl.Background>
		<StaticResource ResourceKey="StatusbarBackground" />
	</UserControl.Background>
	
	<StatusBar  Background="Transparent" >
		<StatusBar.ItemsPanel>
			<ItemsPanelTemplate>
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=1.02}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=1.02}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.8}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.38}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.8}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.22}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.8}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.22}" />
						<ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.6}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.55}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.4}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.54}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.48}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.76}" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.86}" />
						<ColumnDefinition Width="{Binding ActualWidth, ElementName=ReferenceItem, Converter={StaticResource MultiplierConverter}, ConverterParameter=0.7}" />
					</Grid.ColumnDefinitions>
				</Grid>
			</ItemsPanelTemplate>																																			
		</StatusBar.ItemsPanel>

		<StatusBarItem Grid.Column="0" >
			<TextBlock Text="Last Scheduler Check:" Margin="0,3,0,3" x:Name="ReferenceItem" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="1" >
			<TextBlock Text="{Binding LastSchedulerCheck, TargetNullValue=00/00/00&#160;00:00:00}" />
		</StatusBarItem>
		<Separator Grid.Column="2" />
		<StatusBarItem Grid.Column="3" >
			<TextBlock Text="Last Data Received:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="4" >
			<TextBlock Text="{Binding LastDataReceived, TargetNullValue=00/00/00&#160;00:00:00}" />
		</StatusBarItem>
		<Separator Grid.Column="5"/>
		<StatusBarItem Grid.Column="6" >
			<TextBlock Text="Data Refreshes:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="7" >
			<TextBlock Text="{Binding DataRefreshes, TargetNullValue=00000}" />
		</StatusBarItem>
		<Separator Grid.Column="8"/>
		<StatusBarItem Grid.Column="9" >
			<TextBlock Text="Reconnections:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="10" >
			<TextBlock Text="{Binding Reconnections, TargetNullValue=000}" />
		</StatusBarItem>
		<Separator Grid.Column="11" />
        <StatusBarItem Grid.Column="12" >
            <TextBlock Text="Skipped Items:" />
        </StatusBarItem>
        <StatusBarItem Grid.Column="13" >
            <TextBlock Text="{Binding SkippedItems, TargetNullValue=000}" />
        </StatusBarItem>
        <Separator Grid.Column="14" />
        <StatusBarItem Grid.Column="16" >

		</StatusBarItem>

		<StatusBarItem Grid.Column="17" >
			<TextBlock Text="RT Capture:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="18" >
			<Wpf:MultiStateLabel ActiveState="{Binding RealTimeCaptureState, Converter={StaticResource EnumConverter}}" HorizontalAlignment="Left" >
				<Wpf:MultiStateLabel.States>
					<Wpf:LabelState Id="0"  Text="Disabled" Brush="{StaticResource RedGradient}" BorderBrush="DarkRed"  EnableBlink="False" />
					<Wpf:LabelState Id="1" Text="Enabling" Brush="{StaticResource YellowGradient}" BorderBrush="DarkGoldenrod" EnableBlink="True" />
					<Wpf:LabelState Id="2" Text="Enabled" Brush="{StaticResource GreenGradient}" BorderBrush="DarkGreen" EnableBlink="False" />
					<Wpf:LabelState Id="3" Text="Disabling" Brush="{StaticResource YellowGradient}" BorderBrush="DarkGoldenrod" EnableBlink="True" />
				</Wpf:MultiStateLabel.States>
			</Wpf:MultiStateLabel>
		</StatusBarItem>
		<Separator Grid.Column="19" />
		<StatusBarItem Grid.Column="20" >
			<TextBlock Text="Engine:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="21" >
			<Wpf:MultiStateLabel ActiveState="{Binding EngineStarted}" HorizontalAlignment="Left" >
				<Wpf:MultiStateLabel.States>
					<Wpf:LabelState Id="0"  Text="Stopped" Brush="{StaticResource RedGradient}" BorderBrush="DarkRed"  EnableBlink="False" />
					<Wpf:LabelState Id="1" Text="Started" Brush="{StaticResource GreenGradient}" BorderBrush="DarkGreen" EnableBlink="False" />
				</Wpf:MultiStateLabel.States>
			</Wpf:MultiStateLabel>
		</StatusBarItem>
		<Separator Grid.Column="22" />
		<StatusBarItem Grid.Column="23" >
			<TextBlock Text="Accessor:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="24" >
			<Wpf:MultiStateLabel ActiveState="{Binding Connected}" HorizontalAlignment="Left" >
				<Wpf:MultiStateLabel.States>
					<Wpf:LabelState Id="0"  Text="Disconnected" Brush="{StaticResource RedGradient}" BorderBrush="DarkRed"  EnableBlink="False" />
					<Wpf:LabelState Id="1" Text="Connected" Brush="{StaticResource GreenGradient}" BorderBrush="DarkGreen" EnableBlink="False" />
				</Wpf:MultiStateLabel.States>
			</Wpf:MultiStateLabel>
		</StatusBarItem>
		<Separator Grid.Column="25" />
		<StatusBarItem Grid.Column="26" >
			<TextBlock Text="Historical Engine:" />
		</StatusBarItem>
		<StatusBarItem Grid.Column="27" >
			<Wpf:MultiStateLabel ActiveState="{Binding HistoricalSystemState, Converter={StaticResource EnumConverter}}" HorizontalAlignment="Left" >
				<Wpf:MultiStateLabel.States>
					<Wpf:LabelState Id="0"  Text="Not Loaded" Brush="{StaticResource RedGradient}" BorderBrush="DarkRed"  EnableBlink="False" />
					<Wpf:LabelState Id="1" Text="Loading" Brush="{StaticResource GreenGradient}" BorderBrush="DarkGoldenrod" EnableBlink="True" />
					<Wpf:LabelState Id="2" Text="Loaded" Brush="{StaticResource GreenGradient}" BorderBrush="DarkGreen" EnableBlink="False" />
				</Wpf:MultiStateLabel.States>
			</Wpf:MultiStateLabel>
		</StatusBarItem>

	</StatusBar>
</UserControl>
